# Gunther's much quicker solution
N = eval(input("Enter the start point N: "))
M = eval(input("Enter the end point M: "))
print("The palindromic primes are: ")
for i in range (N + 1,M):
j = str(i)
k = j[::-1]
if j == k :
l = int(j)
if l > 1:
for m in range(2,l):
if (l % m) == 0:
break
else:
print(l)